home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 89 / maccd 89.iso / utilities / Mac OS X / Monolingual / Monolingual.app / Contents / Resources / monolingual.pl < prev   
Encoding:
Perl Script  |  2002-01-16  |  2.6 KB  |  73 lines

  1. #!/usr/bin/perl
  2.  
  3. #######################################################################
  4. # monolingual.pl -
  5. #   strips away extra language .lproj from OSX to save space
  6. #
  7. #    Copyright (C) 02001  Joshua Schrier (jschrier@mac.com)
  8. #
  9. #    This program is free software; you can redistribute it and/or modify
  10. #    it under the terms of the GNU General Public License as published by
  11. #    the Free Software Foundation; either version 2 of the License, or
  12. #    (at your option) any later version.
  13. #
  14. #    This program is distributed in the hope that it will be useful,
  15. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. #    GNU General Public License for more details.
  18. #
  19. #    You should have received a copy of the GNU General Public License
  20. #    along with this program; if not, write to the Free Software
  21. #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  22. #
  23. #######################################################################
  24.  
  25. @lang_name = ('Pig-latin','Dutch','English','French','German','Italian','Japanese','Spanish');
  26. @path_name = ('Applications','System','Library');
  27. @offset = (666,-12,-13,-13,-13,-14,-15,-14);
  28.  
  29. if (!(defined($ARGV[0]))) {
  30.     print STDOUT "\nmonolingual, Copyright (C) 02001 J. Schrier\n";
  31.     print STDOUT "\nmonolingual comes with ABSOLUTELY NO WARRANTY; for details refer to\n";
  32.     print STDOUT "the included documentation (readme.txt) or the script itself (monolingual.pl\n";
  33.     print STDOUT "This is free software, and you are welcome to redistribute it\n";
  34.     print STDOUT "under the terms of the GNU Public License (gpl.txt)\n";
  35.  
  36.     print STDOUT "\nLanguage to Remove:\n";
  37.     for my $i (1..7) {
  38.     print STDOUT "$i) $lang_name[$i]\n";
  39.     }
  40.     print STDOUT "Enter your selection: ";
  41.     chop($remove = <STDIN>);
  42.     
  43.     print STDOUT "Are you *SURE* you want to *REMOVE ALL* $lang_name[$remove] ";
  44.     print STDOUT "resources from OS X?\n";
  45.     print STDOUT "You will *NOT* be able to restore them without reinstalling OS X.\n";
  46.     print STDOUT "(Type \'yes\' to REMOVE $lang_name[$remove])  ";
  47.  
  48.     chop($agree = <STDIN>);
  49.     ($agree eq "yes") || die "Your files have *NOT* been changed.\n";
  50. } else {
  51.     $remove = $ARGV[0];
  52. }
  53.  
  54. $newcheck =  $lang_name[$remove].".lproj:";
  55.  
  56. for my $i (0..2) {
  57.     open(RM, "ls -R /$path_name[$i] | grep $newcheck |") || die "Couldn't open ls\n";
  58.     while ($hold = <RM>) {
  59.         chop($hold);
  60.         if (substr($hold,-1) eq ":") {
  61.             $hold =~ s/\s/\\\ /g;
  62.             system("rm -r ".substr($hold,0,-1));
  63.         }
  64.     }
  65.     close(RM);
  66. }
  67.  
  68.  
  69.  
  70.  
  71.   
  72.  
  73.